<script setup lang="ts">
import { PropType,ref } from 'vue'
import type { ViewData } from '@/api/types/userType'
import { Descriptions } from '@/components/Descriptions'
import { ElTag ,ElButton} from 'element-plus'
import { Dialog } from '@/components/Dialog'
defineProps({
  currentRow: {
    type: Object as PropType<Nullable<ViewData>>,
    default: () => null
  },
  detailSchema: {
    type: Array as PropType<DescriptionsSchema[]>,
    default: () => []
  }
})
const dialogVisible=ref(false)
</script>

<template>
  <Descriptions :schema="detailSchema" :data="currentRow || {}">
    <template #status="{ row }: { row: ViewData }">
      <ElTag :type="row.status === 'normal' ? 'success' :  'warning'" >
        {{
          row.status === 'normal'
            ? "正常"
            : '锁定'
        }}
      </ElTag>
    </template>    
  </Descriptions>
  <ElButton @click="dialogVisible = true">查看报告</ElButton>
  <Dialog v-model="dialogVisible" title="评测报告" fullscreen >
    <iframe :src="'/#/device/sensoryReport?id=' + currentRow?.id" style="width: 100%;height: 100%;">
    </iframe>
  </Dialog>
</template>
